<?php

/**
 * 账单
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 2016/10/14
 * Time: 下午5:23
 */
class Bill extends MY_Api_Controller
{
    /**
     * 用户账单
     */
    public function index()
    {
        $uid          = $this->uid;
        $type         = (int)$this->input->get_post('type');
        $is_load_more = (int)$this->input->get_post('is_load_more');
        $page         = (int)$this->input->get_post('page');
        $limit        = (int)$this->input->get_post('limit');


        $this->load->service('finance/service_finance_bill');
        $data = $this->service_finance_bill->index($uid, $type, $is_load_more, $page, $limit);


        $tmp_data = array();
        foreach ($data['data']['bill'] as $k => &$v)
        {
            $v['title'] = $v['business_title'];


            unset($v['real_amount']);
            unset($v['discount']);
            unset($v['aid']);
            unset($v['ip']);
            unset($v['cid']);
            unset($v['business_title']);


            $tmp_data[] = $v;
        }


        $data['data']['bill'] = $tmp_data;


        $this->json_output($data['data'], $data['status']);
    }
}